package com.gxa.config;

/**
 * 万事顺意
 * Created with IntelliJ IDEA.
 * User: zwj
 * Date: 2024/04/2814:45
 * Description:
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.sql.Timestamp;

/**
 * @Configuration 表示当前类是一个配置类,能够被Spring在启动的时候加载
 * @EnableSwagger2 开启swagger功能
 * @author bill
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
   @Bean
    public Docket api(){
       return new Docket(DocumentationType.SWAGGER_2)
               .apiInfo(apiInfo())
               .select()
               .apis(RequestHandlerSelectors.basePackage("com.gxa.controller"))
               .paths(PathSelectors.any())
               .build()
               .ignoredParameterTypes(Timestamp.class)

               ;

   }

    private ApiInfo apiInfo() {
       return new ApiInfoBuilder()
               .title("物流系统")
               .description("物流系统的测试接口")
               .termsOfServiceUrl("")
               .version("1.0")
               .build();
    }
}
